import pygame
from pygame.locals import *
from pygame import *
import sys
import config

class loadletter(pygame.sprite.Sprite):
    def __init__(self, text, application):
        pygame.sprite.Sprite.__init__(self)
        font = pygame.font.Font(application.font, application.fontsize)
        font.set_bold(application.fontbold)
        font.set_italic(application.fontitalic)
        label_text = font.render(text, 1, application.fontcolor)
        self.image = label_text
        self.rect = self.image.get_rect()

class loadimage(pygame.sprite.Sprite):
    def __init__(self, name, max_width, max_height):
        # Call sprite initializer
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.transform.scale(pygame.image.load(name).convert_alpha(), (max_width, max_height))
        self.rect = self.image.get_rect()

class loadback(pygame.sprite.Sprite):
    def __init__(self, name, max_width, max_height, application):
        # Call sprite initializer
        pygame.sprite.Sprite.__init__(self)
        # Load white background and scale to max_width & max_height
        self.image = pygame.transform.scale(pygame.image.load(name).convert(), (max_width, max_height))
        self.rect = self.image.get_rect()
        # Postions
        self.rect.x = pygame.display.get_surface().get_rect().centerx  - self.rect.width/2
        self.rect.y = pygame.display.get_surface().get_rect().centery  - self.rect.height/2

class loadlabel(pygame.sprite.Sprite):
    def __init__(self, text, fs, fc, f, bold, italic):
        # Call sprite initializer
        pygame.sprite.Sprite.__init__(self)
        font = pygame.font.Font(f, fs)
        font.set_bold(bold)
        font.set_italic(italic)
        self.image = font.render(text, 1, fc)
        self.rect = self.image.get_rect()

class loadvertical(pygame.sprite.Sprite):
    def __init__(self, name, max_width):
        # Call sprite initializer
        pygame.sprite.Sprite.__init__(self)
        # Load white background and scale to max_width & max_height
        self.image = pygame.transform.scale(pygame.image.load(name).convert(), (max_width, 16))
        self.rect = self.image.get_rect()

class loadhorizontal(pygame.sprite.Sprite):
    def __init__(self, name, max_height):
        # Call sprite initializer
        pygame.sprite.Sprite.__init__(self)
        # Load white background and scale to max_width & max_height
        self.image = pygame.transform.scale(pygame.image.load(name).convert(), (16, max_height))
        self.rect = self.image.get_rect()
